home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / HorizontalSliderBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  4KB  |  135 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  07/17/97    LAB    Moved connection for setTickStyle property back into base class,
  8. //                    since that's where it is now.
  9. //  09/07/97    LAB    Fixed misspelling of descriptions.
  10. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  11.  
  12. /**
  13.  * BeanInfo for HorizontalSlider.
  14.  *
  15.  */
  16.  
  17. public class HorizontalSliderBeanInfo extends SimpleBeanInfo {
  18.  
  19.     /**
  20.      * Constructs a HorizontalSliderBeanInfo object.
  21.      */
  22.     public HorizontalSliderBeanInfo() {
  23.     }
  24.  
  25.     /**
  26.      * Gets a BeanInfo for the superclass of this bean.
  27.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  28.      */
  29.     public BeanInfo[] getAdditionalBeanInfo() {
  30.         try {
  31.             BeanInfo[] bi = new BeanInfo[1];
  32.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  33.             return bi;
  34.         }
  35.         catch (IntrospectionException e) { throw new Error(e.toString());}
  36.     }
  37.  
  38.     /**
  39.      * Gets the SymantecBeanDescriptor for this bean.
  40.      * @return an object of type SymantecBeanDescriptor
  41.      * @see symantec.itools.beans.SymantecBeanDescriptor
  42.      */
  43.     public BeanDescriptor getBeanDescriptor() {
  44.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  45.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  46.         String s=group.getString("GroupAWTAdditions"); 
  47.  
  48.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  49.         bd.setFolder(s);
  50.         bd.setWinHelp("0x123AA");
  51.  
  52.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  53.                                                 "%name%.TICK_TOP",
  54.                                                 conn.getString("TICK_TOP")));
  55.  
  56.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  57.                                                 "%name%.TICK_BOTTOM",
  58.                                                 conn.getString("TICK_BOTTOM")));
  59.  
  60.  
  61.         bd.addAdditionalConnections(getAdditionalBeanInfo());
  62.  
  63.         return (BeanDescriptor) bd;
  64.     }
  65.  
  66.     /**
  67.      * Gets an image that may be used to visually represent this bean
  68.      * (in the toolbar, on a form, etc).
  69.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  70.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  71.      * @return an image for this bean, always color even if requested monochrome
  72.      * @see BeanInfo#ICON_MONO_16x16
  73.      * @see BeanInfo#ICON_COLOR_16x16
  74.      * @see BeanInfo#ICON_MONO_32x32
  75.      * @see BeanInfo#ICON_COLOR_32x32
  76.      */
  77.     public java.awt.Image getIcon(int iconKind) {
  78.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  79.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  80.             java.awt.Image img = loadImage("HorizontalSliderC16.gif");
  81.             return img;
  82.         }
  83.  
  84.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  85.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  86.             java.awt.Image img = loadImage("HorizontalSliderC32.gif");
  87.             return img;
  88.         }
  89.  
  90.         return null;
  91.     }
  92.  
  93.     /**
  94.      * Gets an array of descriptions of the methods used for "connections" by
  95.      * Visual CafΘ's Interaction Wizard.
  96.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  97.      * @return method descriptions for this bean
  98.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  99.      */
  100.     public MethodDescriptor[] getMethodDescriptors() {
  101.         Class[] args;
  102.         ConnectionDescriptor connection;
  103.         java.util.Vector connections;
  104.         java.util.Vector md = new java.util.Vector();
  105.  
  106.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  107.         md.copyInto(rv);
  108.  
  109.         return rv;
  110.     }
  111.  
  112.     /**
  113.      * Returns descriptions of this bean's properties.
  114.      */
  115.     public PropertyDescriptor[] getPropertyDescriptors() {
  116.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  117.         String s;
  118.  
  119.         try{
  120.         PropertyDescriptor tickStyle = new PropertyDescriptor("tickStyle", beanClass);
  121.         tickStyle.setBound(true);
  122.         tickStyle.setConstrained(true);
  123.         tickStyle.setDisplayName(prop.getString("tickStyle"));
  124.         tickStyle.setValue("ENUMERATION", "TICK_BOTTOM=0, TICK_TOP=1, TICK_BOTH=2, TICK_NONE=3");
  125.  
  126.  
  127.         PropertyDescriptor[] rv = {
  128.             tickStyle};
  129.         return rv;
  130.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  131.     }
  132.  
  133.     private final static Class beanClass = HorizontalSlider.class;
  134.  
  135.     }    //  end of class HorizontalSliderBeanInfo